<template>
  <div ref="myChart" style="width:300px; height: 300px">

  </div>
</template>

<script>
  let Echarts = require('echarts'); //基础实例 注意不要使用import
  export default {
    name: "test",
    data(){
      return{
        option: {
          xAxis: {
            type: 'category',
            data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
          },
          yAxis: {
            type: 'value'
          },
          series: [{
            data: [150, 230, 224, 218, 135, 147, 260],
            type: 'line'
          }]
        },
      }
    },
    methods:{
      einit(){
        let chart = Echarts.init(this.$refs.myChart);
        chart.setOption(this.option);
      }
    },
    mounted(){
      this.einit();
    }
  }
</script>

<style scoped>

</style>
